#include<bits/stdc++.h>

using namespace std;
using ll=long long;
#define  endl  '\n'

bool judge(ll n) {
    ll left = 1, right = n;
    while (left <= right) {
        ll mid = (left + right) / 2;
        ll dif = mid * (mid + 1) / 2 - n;
        if (dif == 0) {
            return true;
        }
        if (dif < 0) {
            left = mid + 1;
        } else {
            right = mid - 1;
        }
    }
    return false;

}


int main() {
    ll n;
    cin >> n;
    if (judge(n)) {
        cout << "YES" << endl;
    } else {
        cout << "NO" << endl;
    }
    return 0;
}